home *** CD-ROM | disk | FTP | other *** search
/ Better Homes & Gardens: …oking for Today - Chicken / Image.iso / pc / personal.dxr / 00004_pull down menu.ls < prev    next >
Encoding:
Text File  |  1995-11-20  |  1.8 KB  |  61 lines

  1. property mySprite, myHilite, menuCast, buttonCast, myField, myList, mySelection, myFunction
  2.  
  3. on birth me, spriteNum1, spriteNum2, castNum1, castNum2, fieldName, listString, handler
  4.   set mySprite to spriteNum1
  5.   set myHilite to spriteNum2
  6.   set menuCast to castNum1
  7.   set buttonCast to castNum2
  8.   set myField to fieldName
  9.   set myList to listString
  10.   set mySelection to line 1 of myList
  11.   set myFunction to handler
  12.   puppetSprite(mySprite, 1)
  13.   puppetSprite(myHilite, 1)
  14.   set the textHeight of field myField to 18
  15.   put mySelection into field myField
  16.   return me
  17. end
  18.  
  19. on menuSelect me
  20.   set the castNum of sprite mySprite to menuCast
  21.   repeat with i = 41 to 47
  22.     set the visible of sprite i to 0
  23.   end repeat
  24.   updateStage()
  25.   put myList into field myField
  26.   set oldSelection to mySelection
  27.   set doOnce to 1
  28.   repeat while the stillDown or doOnce
  29.     set doOnce to 0
  30.     if rollOver(mySprite) then
  31.       set lineNum to the mouseLine
  32.       if lineNum > 0 then
  33.         set loc to the locV of sprite mySprite - 18
  34.         set the locV of sprite myHilite to loc + (lineNum * 18)
  35.         set the visible of sprite myHilite to 1
  36.         set mySelection to line lineNum of field myField
  37.       end if
  38.     else
  39.       set the visible of sprite myHilite to 0
  40.       set mySelection to oldSelection
  41.     end if
  42.     updateStage()
  43.   end repeat
  44.   set the castNum of sprite mySprite to buttonCast
  45.   set the locV of sprite myHilite to the locV of sprite mySprite
  46.   set the visible of sprite myHilite to 1
  47.   put mySelection into field myField
  48.   repeat with i = 41 to 47
  49.     set the visible of sprite i to 1
  50.   end repeat
  51.   updateStage()
  52.   if stringp(myFunction) then
  53.     do(myFunction)
  54.   end if
  55. end
  56.  
  57. on controlSelection me, selection
  58.   set mySelection to line selection of myList
  59.   put mySelection into field myField
  60. end
  61.